<include file="Public:top" />
<!--头部 end-->
 <include file="Public:menu" /> 
 <!--菜单 end-->

	<form method="post" class="form-x" action="system.html">
                </div>
                <div class="form-group">
                    <div class="label"><label for="username">用户名</label></div>
                    <div class="field">
                    	<input type="text" class="input" id="title" name="username" size="20" value="{$result.username}" placeholder="用户名用于登陆" data-validate="required:请填写用户名，建议在6字以内。" />
                    	<i></i>
                    </div>
                </div>
                <i style="color:red;">不修改密码不填密码 </i>
                <div class="form-group">
                    <div class="label"><label for="password">新密码</label></div>
                    <div class="field">
                    	<input type="password" class="input"  name="password" size="20" placeholder="登陆新密码" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="label"><label for="pwd1">确认密码</label></div>
                    <div class="field">
                    	<input type="password" class="input" name="pwd1" size="20" placeholder="确认登陆密码和上面密码一致" />
                    </div>
                </div>
                 <input type="hidden" name="user_id" value="{$result.user_id}">
                <div class="form-button" align="center" ><button class="button bg-main" type="submit" id="sure">提交</button></div>
            </form>

  <include file="Public:box" /> 
 <!--底部 end-->
<script>
    
         //表单校验
        $('#title').blur(function(){

            var _this = $(this);

            var _info = _this.next('i');

           //alert(_info.textarea);

            $.post('/console/Console/ajaxCheckName',{username:_this.val()},function(data){

                if ( data.status )
                {
                    _info.text(data.info);

                    _info.css('color','green');

                }
                else
                {

                   _info.text(data.info);

                    _info.css('color','red'); 

                }

            },'json');

        })

     //异步表单提交
        $('#sure').click(function(){


            $.post('/console/Console/doUpdate',$('form').serialize(),function(data){

                if ( data.status )
                {
                    layer.alert(data.info, 1);

                    //重新登陆
                    location.href = "/Console/Base/quit";
                }
                else
                {

                    layer.alert(data.info);

                }

            },'json');

            return false;

        })
</script>